/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

/**
 *
 * @author Pablo
 */
@Entity
public class SalidaCombustible implements Serializable {
    @ManyToOne
    private TipoCombustible tipoCombustible;
    @ManyToOne
    private Vehiculo vehiculo;
    @ManyToOne
    private Tanque tanque;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    private double litros_cargados;
    private double disponiblesEnTanque;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date fecha;
    private String hora;
    
    @OneToOne(cascade = CascadeType.MERGE)
    private Usuario responsable;

    public TipoCombustible getTipoCombustible() {
        return tipoCombustible;
    }

    public void setTipoCombustible(TipoCombustible tipoCombustible) {
        this.tipoCombustible = tipoCombustible;
    }

    public Vehiculo getVehiculo() {
        return vehiculo;
    }

    public void setVehiculo(Vehiculo vehiculo) {
        this.vehiculo = vehiculo;
    }

    public Tanque getTanque() {
        return tanque;
    }

    public void setTanque(Tanque tanque) {
        this.tanque = tanque;
    }

    public double getLitros_cargados() {
        return litros_cargados;
    }

    public void setLitros_cargados(double litros_cargados) {
        this.litros_cargados = litros_cargados;
    }

    public double getDisponiblesEnTanque() {
        return disponiblesEnTanque;
    }

    public void setDisponiblesEnTanque(double disponiblesEnTanque) {
        this.disponiblesEnTanque = disponiblesEnTanque;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getHora() {
        return hora;
    }

    public void setHora(String hora) {
        this.hora = hora;
    }

    public Usuario getResponsable() {
        return responsable;
    }

    public void setResponsable(Usuario responsable) {
        this.responsable = responsable;
    }
   
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SalidaCombustible)) {
            return false;
        }
        SalidaCombustible other = (SalidaCombustible) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.SalidaCombustible[ id=" + id + " ]";
    }
    
}
